<?php


namespace app\api\validate;


use think\Validate;

class Vildate extends Validate
{

    protected $rule = [
        'user_name' => 'max:20|requireIf:account_type,2',
        'school_name' => 'max:50|requireIf:account_type,2',
        'school_address' => 'max:255|requireIf:account_type,2',
        'mobile' => 'require|mobile|unique:user',
        'password' => 'require',
        'account_type' => 'require|integer',
    ];

    protected $message = [
        'user_name.require' => '请输入用户名',
        'user_name.max' => '字数过多',
        'school_name.require' => '请输入用户名',
        'school_name.max' => '字数过多',
        'school_address.max' => '字数过多',
        'school_address.require' => '请输入地址',
        'password.require' => '请输入密码',
        'mobile.unique' => '该手机号已被注册',
        'mobile.require' => '请输入电话号码',
        'mobile.mobile' => '号码格式错误',

    ];

    protected $scene = [
        'register' => ['user_name','school_name','school_address','mobile','password','account_type'],
        'login' => ['mobile','password'],
    ];

}